import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const Home=()=>import('../views/home/Home.vue')
const City=()=>import('../views/city/City.vue')
const Detail=()=>import('../views/detail/Detail.vue')

const routes = [
  {
    path:'',
    redirect:'/home'
  },
  {
    path: '/home',
    name:"Home",
    component:Home
  },
  {
    path:'/city',
    name:'City',
    component:City
  },
  {
    path:'/detail/:id',
    component:Detail
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  scrollBehavior () {
    return { x: 0, y: 0 }
  }
})

export default router
